package com.leetcode.partition16;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/1/5 9:07
 */
public class LC1576替换所有的问号 {

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String s = reader.readLine();
        writer.write(modifyString(s));
        writer.flush();
    }

    public static String modifyString(String s) {
        //首尾拼接一个不可能出现的字符，避免额外判断
        String str = "-" + s + "-";
        char[] answer = str.toCharArray();
        int n = answer.length;
        for (int i = 1; i < n - 1; i++) {
            if (answer[i] != '?') continue;
            for (char j = 'a'; j <= 'z'; j++) {
                if (j != answer[i - 1] && j != answer[i + 1]) {
                    answer[i] = j;
                    break;
                }
            }
        }
        return new String(answer, 1, n - 2);
    }
}
